package redis

import (
	"context"
	"github.com/redis/go-redis/v9"
	"time"
)

var (
	rdb *redis.Client
)

func Init() {
	rdb = redis.NewClient(&redis.Options{
		Password: "redis_KG8HzH",
	})
}

func SetWithExpire(ctx context.Context, key, value string, expire time.Duration) error {
	return rdb.Set(ctx, key, value, expire).Err()
}

func Get(ctx context.Context, key string) (string, error) {
	return rdb.Get(ctx, key).Result()
}
